package com.bsj.power.pls.web;

import com.bsj.power.common.config.global.JsonResult;
import com.bsj.power.common.def.dto.alarmReport.AlarmLevelDTO;
import com.bsj.power.common.def.entity.alarmLevel.AlarmLevel;
import com.bsj.power.common.def.vo.pls.alarm.AlarmTypeVO;
import com.bsj.power.pls.service.AlarmLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description AlarmLevelController
 * @time 2024/9/6 10:05
 */
@RestController
@RequestMapping("/alarmLevel")
public class AlarmLevelController {

    @Autowired
    private AlarmLevelService alarmLevelService;

    /**
     * 报警类型列表
     *
     * @return com.bsj.power.common.config.global.JsonResult<java.util.List < com.bsj.power.common.constant.AlarmEnum>>
     * @author ljx
     * @time 2024/9/5 21:52
     */
    @GetMapping("/listAlarmType")
    public JsonResult<List<AlarmTypeVO>> listAlarmType() {
        return JsonResult.success(alarmLevelService.listAlarmType());
    }

    /**
     * 设置报警级别
     *
     * @param alarmLevelDTOS
     * @return com.bsj.power.common.config.global.JsonResult
     * @author ljx
     * @time 2024/9/6 10:54
     */
    @PostMapping("/setAlarmLevel")
    public JsonResult setAlarmLevel(@RequestBody List<AlarmLevelDTO> alarmLevelDTOS) {
        return alarmLevelService.setAlarmLevel(alarmLevelDTOS);
    }


    /**
     * 报警级别列表
     *
     * @param level
     * @return com.bsj.power.common.config.global.JsonResult<java.util.List < com.bsj.power.common.def.entity.alarmLevel.AlarmLevel>>
     * @author ljx
     * @time 2024/9/6 11:01
     */
    @GetMapping("/list")
    public JsonResult<List<AlarmLevel>> listAlarmLevel(Integer level) {
        return JsonResult.success(alarmLevelService.listAlarmLevel(level));
    }


}
